package com.sb.money.entities;

// Generated Dec 2, 2012 10:52:01 PM by Hibernate Tools 3.2.2.GA

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Item generated by hbm2java
 */
@Entity
@Table(name = "item"
        , catalog = "money")
public class Item implements java.io.Serializable {

    private static final long serialVersionUID = -8963290697665501482L;
    private Long itemId;
    private Company companyByItemProducer;
    private Categorization categorization;
    private Company companyByItemSeller;
    private String itemName;
    private double itemPrice;
    private Set<Days> dayses = new HashSet<Days>(0);

    public Item() {
    }

    public Item(Company companyByItemProducer, Categorization categorization,
            Company companyByItemSeller, String itemName, double itemPrice) {
        this.companyByItemProducer = companyByItemProducer;
        this.categorization = categorization;
        this.companyByItemSeller = companyByItemSeller;
        this.itemName = itemName;
        this.itemPrice = itemPrice;
    }

    public Item(Company companyByItemProducer, Categorization categorization,
            Company companyByItemSeller, String itemName, double itemPrice,
            Set<Days> dayses) {
        this.companyByItemProducer = companyByItemProducer;
        this.categorization = categorization;
        this.companyByItemSeller = companyByItemSeller;
        this.itemName = itemName;
        this.itemPrice = itemPrice;
        this.dayses = dayses;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "ITEM_ID", unique = true, nullable = false)
    public Long getItemId() {
        return this.itemId;
    }

    public void setItemId(Long itemId) {
        this.itemId = itemId;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "ITEM_PRODUCER", nullable = false)
    public Company getCompanyByItemProducer() {
        return this.companyByItemProducer;
    }

    public void setCompanyByItemProducer(Company companyByItemProducer) {
        this.companyByItemProducer = companyByItemProducer;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "ITEM_CAT", nullable = false)
    public Categorization getCategorization() {
        return this.categorization;
    }

    public void setCategorization(Categorization categorization) {
        this.categorization = categorization;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "ITEM_SELLER", nullable = false)
    public Company getCompanyByItemSeller() {
        return this.companyByItemSeller;
    }

    public void setCompanyByItemSeller(Company companyByItemSeller) {
        this.companyByItemSeller = companyByItemSeller;
    }

    @Column(name = "ITEM_NAME", nullable = false)
    public String getItemName() {
        return this.itemName;
    }

    public void setItemName(String itemName) {
        this.itemName = itemName;
    }

    @Column(name = "ITEM_PRICE", nullable = false, precision = 22, scale = 0)
    public double getItemPrice() {
        return this.itemPrice;
    }

    public void setItemPrice(double itemPrice) {
        this.itemPrice = itemPrice;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "item")
    public Set<Days> getDayses() {
        return this.dayses;
    }

    public void setDayses(Set<Days> dayses) {
        this.dayses = dayses;
    }

}
